package org.study.springboot.lambda;

import org.study.springboot.entity.Student;

import java.time.LocalDate;
import java.util.ArrayList;
import java.util.List;

public class TestSum {
    public static void main(String[] args) {
        PayDetailToBabModel pay1 = new PayDetailToBabModel();
        pay1.setCityId(1);
        PayDetailToBabModel pay2 = new PayDetailToBabModel();
        pay2.setCityId(2);
        PayDetailToBabModel pay3 = new PayDetailToBabModel();
        pay3.setCityId(3);
        List<PayDetailToBabModel> list = new ArrayList<>();
        list.add(pay1);
        list.add(pay2);
        list.add(pay3);
        System.out.println(list.get(0).getCityId());
        System.out.println(list.get(1).getCityId());
        System.out.println(list.get(2).getCityId());

        int sum = list.stream().mapToInt(e -> e.getCityId()).sum();
        System.out.println(sum);

        LocalDate localDate = LocalDate.now().minusYears(1);
        System.out.println(localDate.toString());

        double v = (100 - 10) * 0.01;
        System.out.println(v);

        StringBuilder stringBuilder = new StringBuilder();
        assemString(stringBuilder);
        String s = stringBuilder.toString();
        System.out.println(stringBuilder.toString());

        List<Student> list1 = new ArrayList();
        list1.add(null);
        if (list1 == null || list1.isEmpty()) {
            System.out.println("null");
        }

        Student student = new Student();
        System.out.println(student.toString());
        int i = 0;
        while (true) {
            System.out.println(i);
            i++;
            if (i == 5) {
                break;
            }
        }
    }
    public static void assemString( StringBuilder stringBuilder){
        stringBuilder.append("aaa");
    }
}
